import {
  Controller,
  Get,
  Post,
  Body,
  Patch,
  Param,
  Delete,
} from '@nestjs/common';
import { PpService } from './pp.service';
import { CreatePpDto } from './dto/create-pp.dto';
import { UpdatePpDto } from './dto/update-pp.dto';
import { PpPipe } from './pp.pipe'; //管道
import { ApiOperation, ApiTags } from '@nestjs/swagger';

@Controller('pp')
@ApiTags('pp模块')
export class PpController {
  constructor(private readonly ppService: PpService) {}

  @Post()
  @ApiOperation({
    summary: 'pp模块, 管道验证',
  })
  create(@Body(PpPipe) createPpDto: CreatePpDto) {
    return this.ppService.create(createPpDto);
  }

  @Get()
  findAll() {
    return this.ppService.findAll();
  }

  @Get(':id')
  findOne(@Param('id') id: string) {
    return this.ppService.findOne(+id);
  }

  @Patch(':id')
  update(@Param('id') id: string, @Body() updatePpDto: UpdatePpDto) {
    return this.ppService.update(+id, updatePpDto);
  }

  @Delete(':id')
  remove(@Param('id') id: string) {
    return this.ppService.remove(+id);
  }
}
